// mis
etf->Scan("PXISection.Index()", "CUTG");
// tracking
etf->GetEntries("Length$(postMagTrackerX)")
etf->GetEntries("Length$(mpostMagTrackerX)")
etf->Draw("postMagTrackerX.GetNofHits()>>(9, -1.5, 7.5)");
etf->Draw("mpostMagTrackerX.GetNofHits()>>(9, -1.5, 7.5)");
etf->Draw("postMagTrackerX->GetNStripStray()>>(500, -4., 4.)");
etf->Draw("mpostMagTrackerX->GetNStripStray()>>(500, -4., 4.)");
// x1 v.s. x2
etf->Draw("pidm.x2:pidm.x1>>(500, -1200., 1200., 500, -1200., 1200.)", "", "col");
// aoz
etf->Draw("pidm.aoz>>(500, -4., 6.)");
etf->Draw("pidm.aoz>>(500, -0.5, 2.)");
etf->Draw("pidm.m()>>(500, -5000., 8000.)");
etf->Draw("postMagTracker3D.GetHitPosY(\"tofw\"):postMagTracker3D.GetHitPosX(\"tofw\")>>(500, -500., 500., 500, -500., 500.)", "", "col");
etf->Draw("mpostMagTracker3D.GetHitPosY(\"tofwm\"):mpostMagTracker3D.GetHitPosX(\"tofwm\")>>(500, -500., 500., 500, -500., 500.)", "", "col");
etf->Draw("pidm.beta:mpostMagTrackerX.GetNStripStray()>>(500, -10., 10., 500, 0., .8)", "Length$(mpostMagTrackerX)==1&&Length$(pidm)==1&&!pidm.dcArrId", "colbox");
etf->Draw("pidm.beta:postMagTrackerX.GetNStripStray()>>(500, -10., 10., 500, 0., .8)", "Length$(postMagTrackerX)==1&&Length$(pidm)==1&&pidm.dcArrId", "colbox");
etf->Draw("pidm.m():postMagTrackerX.GetNStripStray()>>(500, -3., 3., 500, -5000., 8000.)", "Length$(postMagTrackerX)==1&&Length$(pidm)==1&&pidm.dcArrId", "colbox");
etf->Draw("pidm.m():mpostMagTrackerX.GetNStripStray()>>(500, -3., 3., 500, -5000., 8000.)", "Length$(mpostMagTrackerX)==1&&Length$(pidm)==1&&!pidm.dcArrId", "colbox");
etf->Draw("pidm.aoz:mpostMagTrackerX.GetNStripStray()>>(500, -3., 3., 500, -3., 5.)", "Length$(mpostMagTrackerX)==1&&Length$(pidm)==1&&!pidm.dcArrId", "colbox");

// energy spectrum of pion
// 1. get a cut of pionplus: pionplus
etf->Draw("pidm.bm2:pidm.poz>>(500, -1000., 2000., 500, 0., 20)", "1;poz [MeV/c];\\beta^{-2}", "colbox");
etf->Draw("pidm.bm2_(2):pidm.poz*1.>>(500, -1000., 2000., 500, 0., 20)", "1;poz [MeV/c];\\beta^{-2}", "samecolbox");
etf->Draw("pidm.beta_(2)>>(500, 0., 1.)");
etf->Draw("pidm.aoz_(2)>>(500, -4., 6.)");
etf->Draw("pidm.aoz>>(500, -4., 6.)");
etf->Draw("pidm.beta>>(500, 0., 1.)");
// 0. the curves
etf->Draw("pidm.bm2:pidm.poz>>(500, -1000., 2000., 500, 0., 20)", "1;poz [MeV/c];\\beta^{-2}", "colbox");
TF1 *fpionplus = new TF1("fpionplus", "1.+pow(139.5706/x, 2)", 0., 2000.); fpionplus->SetNpx(10000);
TF1 *fpionmius = new TF1("fpionmius", "1.+pow(139.5706/(-x), 2)", -1500., 0.); fpionmius->SetNpx(10000);
TF1 *fkaonplus = new TF1("fkaonplus", "1.+pow(493.677/x, 2)", 0., 2000.); fkaonplus->SetNpx(10000);
TF1 *fkaonminus = new TF1("fkaonmius", "1.+pow(493.677/(-x), 2)", -1500., 0.); fkaonmius->SetNpx(10000);
TF1 *fproton = new TF1("fproton", "1.+pow(1.00728*931.494061/x, 2)", 0., 2000.); fproton->SetNpx(10000);
TF1 *fdeutron = new TF1("fdeutron", "1.+pow(2.01355*931.494061/x, 2)", 0., 2000.); fdeutron->SetNpx(10000);
TF1 *ftriton = new TF1("ftriton", "1.+pow(3.0155*931.494061/x, 2)", 0., 2000.); ftriton->SetNpx(10000);
fpionplus->Draw("same"); fpionmius->Draw("same");
fkaonplus->Draw("same"); fkaonminus->Draw("same"); fproton->Draw("same");
fdeutron->Draw("same"); ftriton->Draw("same");
// 2. selecting pionplus
etf->Draw("pidm.beta>>h1(250, 0., 0.7)", "pionplus;\\beta_{\\pi^{+}}");
etf->Draw("pidm.gamma*ETFMath::PionPMMass()>>h2(250, 140., 200.)", "pionplus;m_{\\pi^{+}} [MeV]");
// 3. parallel and transverse momemtum - pion
etf->Draw("pidm.pozp>>h3(250, -50., 500.)", "pionplus;poz_{\\parallel} [MeV/c]");
etf->Draw("pidm.pozt>>h4(500, -50., 500.)", "pionplus;poz_{\\perp} [MeV/c]");
// 3. parallel and transverse momemtum - proton
etf->Draw("pidm.pozp>>h5(250, -50., 500.)", "proton;poz_{\\parallel} [MeV/c]");
etf->Draw("pidm.pozt>>h6(500, -50., 500.)", "proton;poz_{\\perp} [MeV/c]");
etf->Draw("pidm.gamma*938.27534>>h7(250, 140., 200.)", "proton;m_{p} [MeV]");
etf->Draw("pidm.beta>>h1(250, 0.1, 0.8)", "proton;\\beta_{p}");



TClonesArray *c = new TClonesArray("ETFTrack");
etf->SetBranchAddress("mpostMagTrackerX", &c);
etf->GetEntry(0);
ETFVTrack *t = dynamic_cast<ETFVTrack *>(c->At(0));
t->Print();

